package com.demo2do.fms.entity.authority;

import com.demo2do.core.utils.Alias;

/**
 * 角色模板
 * 
 * @author Ysy
 *
 */
@Alias("roleTemplate")
public enum RoleTemplate {

    SUPER_USER("超级用户", "超级用户", false),
    
    ADMIN_USER("总部用户", "总部用户", true),
    
    BRANCH_USER("分区用户", "分区用户", true),
    
    FMS_USER("专属供应商", "专属供应商", true),
    
    SPONSOR_USER("一级供应商用户", "一级供应商用户", true),
    
    SUPPLIER_USER("二级供应商用户", "二级供应商用户", true),

    COMMON_STORAGE_USER("一般仓储用户", "一般仓储用户", true);

    private String name;
    
    private String description;
    
    /** 是否可由该模板派生角色*/
    private Boolean extensible;
    
    /**
     * 
     * @param name
     * @param description
     */
    private RoleTemplate(String name, String description, Boolean extensible) {
        this.name = name;
        this.description = description;
        this.extensible = extensible;
    }

    /**
     * 
     * @param ordinal
     * @return
     */
    public static RoleTemplate ordinalOf(int ordinal) {
        for(RoleTemplate roleTemplate : RoleTemplate.values()){
            if(roleTemplate.ordinal() == ordinal)
                return roleTemplate;
        }
        return null;
    }
    
    /**
     * 
     * @return
     */
    public int getOrdinal(){
        return this.ordinal();
    }
    
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }
    
    /**
     * @return the extensible
     */
    public Boolean getExtensible() {
        return extensible;
    }
    
}